<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>输出输入区间的质数</title>
</head>
<body>
    <script>
        function numSection(num1,num2){
            //确定区间大小值
            var num1 = parseInt(prompt('请输入第一个数'));
            var num2 = parseInt(prompt('请输入第二个数'));
            
            //判断大小值
            if(num1 > num2){
                maxNum = num1;
                minNum = num2;
            }else{
                maxNum = num2;
                minNum = num1;
            }
            console.log('最小:'+minNum+'，最大:'+maxNum);

            //开始执行

            //外循环执行max-min次
            for(var j=1;j<=maxNum-minNum;j++){
                //假设是质数
                var isPrime = true;
                //内循环执行min次
                for(var i=2;i<minNum;i++){
                    if(minNum%i === 0){
                        isPrime = false;
                        break;
                    }
                }
                if(isPrime){
                    document.write(minNum + '<br/>');
                }
                //min自增
                minNum++;
            }
        }
        //调用
        numSection();
    </script>
</body>
</html>